package org.example.my_netty.myNettyHandlerChain;

import org.example.my_netty.SocketChannelContext;

import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;


//第二个处理器 负责回信息
public class MySecondHandler implements MyNettyHandler {
    @Override
    public void handle(SocketChannel channel, SocketChannelContext socketChannelContext) throws Exception {


        String  msg = (String) socketChannelContext.getMsg();
        System.out.println("第二个处理器拿到的消息是：" + msg);

        // 回复客户端
        channel.write(ByteBuffer.wrap("hello\n".getBytes()));


    }

}
